UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VE5O7gOx3pCx+gL6UnW5Tu6eD9Pz0SD56CvrdDlKC90=' 
WHERE 
  key_id = 'd50da68f6433d9aaa3452940ac63749e41cf9132856535a24db49b73b011743d' 
  AND (
    token = 'VE5O7gOx3pCx+gL6UnW5Tu6eD9Pz0SD56CvrdDlKC90=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043