UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wrc5/8lD7Enlg10UbVb634aAUWn407HF3N5Z49fyq1A=' 
WHERE 
  key_id = '398df95576c051073ee0bf674deff9925b0a4bbdd709a1dcce9e8ccf47e3ddb9' 
  AND (
    token = 'wrc5/8lD7Enlg10UbVb634aAUWn407HF3N5Z49fyq1A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054