UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QMysjdcoWTEvmXq4qphOGqr9tJKpTdOfzB0Foxop4ac=' 
WHERE 
  key_id = 'bdb783db686bfefea08625352c30ed7cde539a8e7d065b5b8da209dea458480e' 
  AND (
    token = 'QMysjdcoWTEvmXq4qphOGqr9tJKpTdOfzB0Foxop4ac=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034