UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kEkI3Uwz1X5k/JQj+5nSXrjPay2P1Zltx8WIuo5X1Dg=' 
WHERE 
  key_id = 'fdae47a8b9a778fb7023d49be1d70a5b7fcaa2dfbb0b0567e91febf028f7c54e' 
  AND (
    token = 'kEkI3Uwz1X5k/JQj+5nSXrjPay2P1Zltx8WIuo5X1Dg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053