UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Pb3Tx9k3tym1MsoAbk8veSL3AffEhvNUlDTLU3wWFdM=' 
WHERE 
  key_id = 'cea25293e0ba434c46e4b0b1acde5bb340419712bd91c0c4c25423666cef07ee' 
  AND (
    token = 'Pb3Tx9k3tym1MsoAbk8veSL3AffEhvNUlDTLU3wWFdM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037