UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YRHpoRMKJq2iE8gRDPmp3SFrmjDtMYKd2Mgm1y4UfA0=' 
WHERE 
  key_id = '4bc87dc2785c0542f92ad67f8314e881d3ce28445c863863cfd963ec2f7f6a26' 
  AND (
    token = 'YRHpoRMKJq2iE8gRDPmp3SFrmjDtMYKd2Mgm1y4UfA0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033