UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ytl8UvBcZmTFHgQsycXzanih1FKhhmZJpMBR306obLk=' 
WHERE 
  key_id = '0f412588bd2c2532237cb318051e3ba1d06426e9032f6d5fb606329009dd6f5f' 
  AND (
    token = 'Ytl8UvBcZmTFHgQsycXzanih1FKhhmZJpMBR306obLk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039