UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B0+CQj3qwI2l4jzXZ9uyyMpPP7r/BJv+hvDvI/Ot+XY=' 
WHERE 
  key_id = 'ea36db3bcf5fccc5185d2ac26056745a17f00dc13c1897459fafe9c4a354534b' 
  AND (
    token = 'B0+CQj3qwI2l4jzXZ9uyyMpPP7r/BJv+hvDvI/Ot+XY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033