UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EQm8YQcV4tdf0dMWU2k5/REaeB2w/ONJnpNVoBANQNY=' 
WHERE 
  key_id = 'afe67d86cae7cd5a5fc11438c17172e1753d9882a76dc0afac21ea7fd0c08ca0' 
  AND (
    token = 'EQm8YQcV4tdf0dMWU2k5/REaeB2w/ONJnpNVoBANQNY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041