UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R4gNUXVljSo5XBmZI0yjnRr1eJpIjjmJdTrZdZZYFi8=' 
WHERE 
  key_id = '50b8934807ae049601837b84afe07d2869740a498907d6be451c36e53769abaa' 
  AND (
    token = 'R4gNUXVljSo5XBmZI0yjnRr1eJpIjjmJdTrZdZZYFi8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030