UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yzknvrqCys4wXI5qbVmmBZEveSWiuVtE6p+aTsCco3s=' 
WHERE 
  key_id = '456e1585c5ec7e98fb895a70204176f0b9e20ed0de8602d05c687ba165d3090c' 
  AND (
    token = 'yzknvrqCys4wXI5qbVmmBZEveSWiuVtE6p+aTsCco3s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032