UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'So/pBpEy4d38ziGb6zBKud3ufkzKkbY08uwWVDDVU8c=' 
WHERE 
  key_id = '8976e6595a6ba3a961cc8e432fce83604266966a428adb9d0f6b7153e1f956e4' 
  AND (
    token = 'So/pBpEy4d38ziGb6zBKud3ufkzKkbY08uwWVDDVU8c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00136