UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nhpKa/XuB7wQsRlUp6T58Jz1xaK7hsFex81CEznKhX0=' 
WHERE 
  key_id = '24de5d35bf5bc4affc017a9c13a58254cdd73785e3396139404b6776f6df8f33' 
  AND (
    token = 'nhpKa/XuB7wQsRlUp6T58Jz1xaK7hsFex81CEznKhX0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038