UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bbh75RSSrGAOjwaJp0K2Oly8DKTXPhK/JtsTWKUpKI4=' 
WHERE 
  key_id = '4e5957b4952639658ea055588f03019383365cf72d4fb114c25a74f5623c8f31' 
  AND (
    token = 'bbh75RSSrGAOjwaJp0K2Oly8DKTXPhK/JtsTWKUpKI4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029