UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D+5hr6PIkLqx2rk1WdNLqJOMHwM8jWX4dyv98S8JOLY=' 
WHERE 
  key_id = 'f6260f22dd63b975fca09d5b9a377dfcf07b45455d9445402df144ab698446dd' 
  AND (
    token = 'D+5hr6PIkLqx2rk1WdNLqJOMHwM8jWX4dyv98S8JOLY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034