UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fvLnsac1Cwx5AHA+zXD75gEU6j5WNw8gJpyADBiezY4=' 
WHERE 
  key_id = '769523b7109157654b23b5648f1fe478214901d71510b91d186e15a15777e661' 
  AND (
    token = 'fvLnsac1Cwx5AHA+zXD75gEU6j5WNw8gJpyADBiezY4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022