UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yi7kAgqvPdPVprKNscFDgnJdMDv+gdvRA6THcLu7usw=' 
WHERE 
  key_id = '003e980171b123c8d80cc9ce762228fbd49269b25470541ae68090cd014ac8fd' 
  AND (
    token = 'yi7kAgqvPdPVprKNscFDgnJdMDv+gdvRA6THcLu7usw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055