UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1knhJK8vzgg3ngM4o0gag0RmB8SOg9DmksqxR1T3tPc=' 
WHERE 
  key_id = '55e34f3a90efa5194c14a08217cd2eedf08acc23e3978301f4b030252ef40921' 
  AND (
    token = '1knhJK8vzgg3ngM4o0gag0RmB8SOg9DmksqxR1T3tPc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039