UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N34nG3ZQfpYXV+pde0lEkvHKxjjgcstBws9zsilfUAA=' 
WHERE 
  key_id = '6944ae2e99254f091d073b337f12809f6156214744e8a47900bd4ccb5127f36b' 
  AND (
    token = 'N34nG3ZQfpYXV+pde0lEkvHKxjjgcstBws9zsilfUAA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029