UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2kgQz1KXEv11AAYUPlVqxIBWAUSU6fXKaoxRdilD+jU=' 
WHERE 
  key_id = '4e9319d5119cd5adc4368fad3b5a0cc8514fc8c70bf28de2087410eaff27cdb2' 
  AND (
    token = '2kgQz1KXEv11AAYUPlVqxIBWAUSU6fXKaoxRdilD+jU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045