UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6NqVLVz4ZImCN09d4g8uvEfQx7FPFRt+yIxpbs+KgI8=' 
WHERE 
  key_id = '0f2dccc3a6751430fea03326a001c1cf6e8c3bd078bd4c358c157c1c161f7015' 
  AND (
    token = '6NqVLVz4ZImCN09d4g8uvEfQx7FPFRt+yIxpbs+KgI8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041