UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm+jZ8fJKI1gDziSC+AlQAg3DdPNkSYkPFwhCksE/hoY=' 
WHERE 
  key_id = '4f2653af6e1e23601f9763dd8b566d57ae0b54b78570732b58f2da86e77529af' 
  AND (
    token = 'm+jZ8fJKI1gDziSC+AlQAg3DdPNkSYkPFwhCksE/hoY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034