UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hc1gwC0kr3tbN/9UaJzzUMIDQfDDt+U8ROJ2Tp7Rgzc=' 
WHERE 
  key_id = '3780a6ea8fbe781883750f5c7feb35c78292b76701aff88f3287b866de92a833' 
  AND (
    token = 'hc1gwC0kr3tbN/9UaJzzUMIDQfDDt+U8ROJ2Tp7Rgzc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032