UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pyzKxgn/zsyS5pB7EQ6DKPrt1huQ48clVWu5MFWNelY=' 
WHERE 
  key_id = 'd14e5627d2bb159389dc74b064c742ec23ea1584fe2f2a8954557c9e0102efde' 
  AND (
    token = 'pyzKxgn/zsyS5pB7EQ6DKPrt1huQ48clVWu5MFWNelY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026