UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y5KgS0Sa/T7TuY2jxJHHYwHK7n1g5PYoTLfl+YpEfqE=' 
WHERE 
  key_id = 'da4ab73b48aae658ea51db759d3a9ca1386347aa99da24ab3be0511758cf330d' 
  AND (
    token = 'Y5KgS0Sa/T7TuY2jxJHHYwHK7n1g5PYoTLfl+YpEfqE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031