UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kDe+/ayTelnxMd4quSVAqUY+X+rT11Jd28KR5dk0tfg=' 
WHERE 
  key_id = '1512348a50b06e71a915c53c67e361c8caa3d6578103d3b3347cc3a31f131a8f' 
  AND (
    token = 'kDe+/ayTelnxMd4quSVAqUY+X+rT11Jd28KR5dk0tfg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022