UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CRM1n+v+dsAnfs13IyjiwCIhpFtaNMZ/KRZcCZqGDJw=' 
WHERE 
  key_id = 'f774b8059b1785cda68aa2102bfb441d620d8cceb028ace2c91a8c0801591b7f' 
  AND (
    token = 'CRM1n+v+dsAnfs13IyjiwCIhpFtaNMZ/KRZcCZqGDJw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045