UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pu4116Lzen8d03HXivTm99dzeohV//d7jtF8GGby1IQ=' 
WHERE 
  key_id = '001808ec6ecdb4d68e03d6713dc120b495a162afa5999384eca4f11490538012' 
  AND (
    token = 'pu4116Lzen8d03HXivTm99dzeohV//d7jtF8GGby1IQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034