UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pz6pQnb5NCycu0uq5GhuQIJC3Y7NURRlP9qIGn+0Fg4=' 
WHERE 
  key_id = 'b0aceca4dbd851e5974262f451b953830f1ecdf909bbb041b9cca77a16c02659' 
  AND (
    token = 'pz6pQnb5NCycu0uq5GhuQIJC3Y7NURRlP9qIGn+0Fg4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031