UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4SwNi/H956SxM34F82347BpyToXE3Lu2VSMSfQRTovM=' 
WHERE 
  key_id = 'cd8f5f3f297f537b813ca5a6752fb927a5328a74dff8c1ba849a73933ad78f66' 
  AND (
    token = '4SwNi/H956SxM34F82347BpyToXE3Lu2VSMSfQRTovM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036